import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/Index.vue'),
    children: [
      {
        path: '/index/my',
        name: 'my',
        component: () => import('../views/Index/my.vue'),
      },
      {
        path: '/index/order',
        name: 'order',
        component: () => import('../views/Index/Order.vue'),
      },
      {
        path: '/index/tuan',
        name: 'tuan',
        component: () => import('../views/Index/Tuan.vue'),
      },
      {
        path: '/index/first',
        name: 'first',
        component: () => import('../views/Index/First.vue'),
      },
      {
        path: '/',
        redirect: '/index/first',
      },
      //404路由
      {
        path: '*',
        name: 'notefound',
        component: () => import('../views/NoteFound.vue')
      }
    ]
  },
  {
    path: '/',
    redirect: '/index',
  },
  //404路由
  {
    path: '*',
    name: 'notefound',
    component: () => import('../views/NoteFound.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
